import { MemoryManager } from "GameLoop/DecisionMaking/MemoryManager";
 
import { GlobalEntity } from "./GlobalEntity";

interface RoomResource 
{
    rooName:string;
    count:number;
}
 
enum ResourceState
{
    /**
     * 未满
     */
     Shortage,
    /**
     * 已满
     */
     Excess,
}
export class  ResourceCache
{
    cache:Record<ResourceState,RoomResource>={} as any;
    public addRecord(state:ResourceState,arg:RoomResource)
    {

    }
}
/**
 * 资源共享模块
 * 各个房间定时向资源共享模块同步 富足的资源
 */
// export    class ResourceDispatchEntity< T extends INoMemory,V extends IRoomModuleInitializer=IRoomModuleInitializer > extends GlobalEntity< T,V >
// {
//     private cache!:ResourceCache
//     public get region():string{
//         return Game.shard.name
//     }
//     public   getNodeMemory (): T {
//         const regionCache = MemoryManager.getMemory<IMemoryCache>(this.region);
//         if(!regionCache.Nodes ||!regionCache.Nodes[this.key])
//         {
//             throw new Error(`${this.GUID}->${this.entityType()} 的内存未初始化`)
//         }
//         return regionCache.Nodes[this.key]
//     }
//     public initAttributes(): void {
//         this.initNodeMemory();
//         this.cache = new ResourceCache();
//     }
//     public   updateMemory():void
//     {

//     }
//     protected initNodeMemory()
//     {
//         super.initNodeMemory()
//     }

    
//     /**
//      * 注册房间多余资源记录
//     */
//     public registerExcessResource(room: Room, resource: ResourceConstant, amount: number): void {
//         // Add the excess resource record to the cache
//         this.cache.addRecord(ResourceState.Excess, { rooName: room.name, count: amount });
//     }

//     /**
//      * 注册房间短缺资源记录
//     */
//     public registerShortageResource(room: Room, resource: ResourceConstant, amount: number): void {
//         // Add the shortage resource record to the cache
//         this.cache.addRecord(ResourceState.Shortage, { rooName: room.name, count: amount });
//     }


    
// }